home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-22 | 3.5 KB | 151 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CToggleRadioButtonApp.cp ©1996-1997 John C. Daub. All rights reserved.
- // ===========================================================================
- // See "HToggleRadioButton README" for more information
-
- #include "CToggleRadioButtonApp.h"
-
- #include <LGrowZone.h>
- #include <LWindow.h>
- #include <PP_Messages.h>
- #include <PP_Resources.h>
- #include <UDrawingState.h>
- #include <UMemoryMgr.h>
- #include <URegistrar.h>
- #include <LEditField.h>
- #include <LGroupBox.h>
- #include <LStdControl.h>
- #include <LRadioGroup.h>
-
- #include <LToggleButton.h>
- #include "HToggleRadioButton.h"
-
-
- // put declarations for resource ids (ResIDTs) here
-
- const ResIDT window_Sample = 1; // EXAMPLE
-
-
- // ===========================================================================
- // • Main Program
- // ===========================================================================
-
- void main(void)
- {
- // Set Debugging options
- SetDebugThrow_(debugAction_Alert);
- SetDebugSignal_(debugAction_Alert);
-
- InitializeHeap(3); // Initialize Memory Manager
- // Parameter is number of Master Pointer
- // blocks to allocate
-
- // Initialize standard Toolbox managers
- UQDGlobals::InitializeToolbox(&qd);
-
- new LGrowZone(20000); // Install a GrowZone function to catch
- // low memory situations.
-
- CToggleRadioButtonApp theApp; // replace this with your App type
- theApp.Run();
- }
-
-
- // ---------------------------------------------------------------------------
- // • CToggleRadioButtonApp
- // ---------------------------------------------------------------------------
- // Constructor
-
- CToggleRadioButtonApp::CToggleRadioButtonApp()
- {
- RegisterClass_(HToggleRadioButton);
-
- RegisterClass_(LToggleButton);
- RegisterClass_(LStdRadioButton);
- RegisterClass_(LGroupBox);
- RegisterClass_(LWindow);
- RegisterClass_(LRadioGroup);
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~CToggleRadioButtonApp
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- CToggleRadioButtonApp::~CToggleRadioButtonApp()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • StartUp
- // ---------------------------------------------------------------------------
-
- void
- CToggleRadioButtonApp::StartUp()
- {
- ObeyCommand(cmd_New, nil);
- }
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand
- // ---------------------------------------------------------------------------
- // Respond to commands
-
- Boolean
- CToggleRadioButtonApp::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand)
- {
-
- case cmd_New:
-
- LWindow *theWindow;
- theWindow = LWindow::CreateWindow(window_Sample, this);
- theWindow->Show();
- break;
-
-
-
- default:
- cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus
- // ---------------------------------------------------------------------------
- // This function enables menu commands.
- //
-
- void
- CToggleRadioButtonApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
-
- switch (inCommand)
- {
-
- case cmd_New:
- outEnabled = true;
- break;
-
- default:
- LApplication::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-